<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>碰一碰</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
</head>
<body>
  <div class="container">
    <header class="header">
      <button class="back-btn" onclick="window.history.back()">←</button>
      <h2>碰一碰支付</h2>
    </header>
    
    <div class="section">
      <div class="transport-card">
        <div>碰一碰支付</div>
        <div class="card-balance">¥<span id="balance">12345.67</span></div>
        <div>请将手机靠近支付设备</div>
      </div>
      
      <img src="{{ url_for('static', filename='img/pengyipeng.png') }}" alt="碰一碰支付" class="transport-qr-code">
      <p style="text-align: center;">正在等待设备连接...</p>
      
      <div class="action-buttons">
        <button onclick="startTouchPay()">开始支付</button>
        <button onclick="stopTouchPay()">停止支付</button>
      </div>
    </div>
  </div>
  
  <script>
    let touchPayActive = false;
    
    function startTouchPay() {
      touchPayActive = true;
      document.querySelector('.transport-card div:last-child').textContent = "正在搜索附近设备...";
      alert('碰一碰支付已开启，请靠近支付设备');
    }
    
    function stopTouchPay() {
      touchPayActive = false;
      document.querySelector('.transport-card div:last-child').textContent = "请将手机靠近支付设备";
      alert('碰一碰支付已停止');
    }
    
    // 页面加载时更新余额显示
    window.onload = function() {
      document.getElementById('balance').textContent = '12345.67';
    };
  </script>
</body>
</html>